package com.example.im.bean

import androidx.room.*
import java.io.Serializable

//@Entity(indices = [Index(value = ["id"], unique = true)])
@Entity(
    foreignKeys = [ForeignKey(
        entity = UserRoom::class,
        parentColumns = ["id"],
        childColumns = ["u_id"],
        onDelete = ForeignKey.CASCADE
    )], indices = [Index(value = ["u_id"], unique = true)]
)
class ChatLast : Serializable {

    @PrimaryKey(autoGenerate = true)
    var id: Int = 0
    @ColumnInfo(name = "u_id")
    var uid: Int = 0
    @ColumnInfo(name = "t_id")
    var tid: Int = 0
    @ColumnInfo(name = "is_ait")
    var isAit: Boolean = false

    fun getChatLast(): ChatLast = this

    companion object {
        private const val serialVersionUID = 42L
    }
}
